<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="a">
    <span id="b"> </span>
    <script>

        
var input =  document.getElementById('a'),
	 b =  document.getElementById('b'),
 	 data = {},
	 p = new Proxy(data,{		//新建一个proxy对象，data为绑定的变量
          set(obj,prop,value){	//obj被代理的对象，prop设置代理的属性,value新设置的值
          obj[prop] = value
          b.innerHTML = value
          input.value = value
            }
        })
    p.name = e.target.value		//操作代理变量都会触发set方法
    </script>
    
</body>
</html>